package com.cloudfast.oauth.feign;

import java.util.List;
import java.util.Map;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.cloudfast.common.user.LoginUser;
import com.cloudfast.config.reign.CloudFeignAuthConfig;
import com.cloudfast.platform.app.AppClient;
import com.cloudfast.platform.menu.entity.Menu;
import com.cloudfast.platform.role.entity.Role;

/**
 * 用户中心-接口
 *
 * @author liuyw
 * @date 2022年8月29日
 */
@FeignClient(name = "user-center", configuration = CloudFeignAuthConfig.class)
public interface UserCenterFeignService {

    /**
     * 获取登入的信息
     *
     * @param loginName
     * @return
     */
    @PostMapping("/cloud/oauth/findByLoginName")
    public LoginUser findByLoginName(@RequestParam String loginName);

    /**
     * 获取关联的角色
     *
     * @param userId
     * @return
     */
    @PostMapping("/cloud/oauth/findRoleCodeByUserId")
    public List<Role> findRoleCodeByUserId(@RequestParam String userId);

    /**
     * 获取关联的权限
     *
     * @param userId
     * @return
     */
    @PostMapping("/cloud/oauth/findPermissionByUserId")
    public List<Menu> findPermissionByUserId(@RequestParam String userId);

    /**
     * 大屏按钮入口
     * @return
     */
    @PostMapping("/cloud/oauth/screenButtons")
    public List<Menu> screenButtons(@RequestParam Long userId);


    /**
     * 用户的菜单
     * @param permissionScope
     * @return
     */
    @PostMapping("/cloud/oauth/menus")
    public List<Map<String, Object>> userHasMenus(@RequestParam String permissionScope,@RequestParam Long userId);

    /**
     * 根据appLabel 查询app信息
     *
     * @param appLabel
     * @param corpId
     * @param appType
     * @return
     */
    @PostMapping("/app/findOneByLabel")
    public AppClient findAppClientByLabel(@RequestParam String appLabel, @RequestParam String corpId,
                                          @RequestParam String appType);
}
